﻿@using AncientLand.Common
@model AncientLand.Service.Entity.Pager<AncientLand.Service.Entity.News>
@{
    ViewBag.Title = "List";
    Layout = "~/Views/Shared/_AdminLayoutPage.cshtml";
}
<div class="grid_16 widget first">
    <div class="widget_title clearfix">
        <h2>
            时尚资讯列表</h2>
        <ul>
            <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="@Url.Content("~/NewsAdmin/add")" >
                <span>添加时尚资讯</span></a> </li>
        </ul>
    </div>
    <div class="widget_body">
        <div id="table1">
            <div class="dataTables_wrapper">                
                <table class="dataTable">
                    <thead>
                        <tr class="odd">
                            <th class="ui-state-default" rowspan="1" colspan="1" style="width: 10px;">
                                <div class="DataTables_sort_wrapper">
                                    <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-n"></span>
                                </div>
                            </th>
                            <th class="align-left ui-state-default" rowspan="1" colspan="1" style="width: 450px;">
                                <div class="DataTables_sort_wrapper">
                                    标题<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div>
                            </th>
                            <th class="align-left ui-state-default" rowspan="1" colspan="1" style="width: 50px;">
                                <div class="DataTables_sort_wrapper">
                                    被查看次数<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div>
                            </th>
                            <th class="ui-state-default" rowspan="1" colspan="1" style="width: 100px;">
                                <div class="DataTables_sort_wrapper">
                                    创建时间<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div>
                            </th>
                            <th class="ui-state-default" rowspan="1" colspan="1" style="width: 120px;">
                                <div class="DataTables_sort_wrapper">
                                    操作<span class="DataTables_sort_icon css_right ui-icon ui-icon-carat-2-n-s"></span></div>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model.DataSource)
                        {
                            <tr>
                                <td class="sorting_1">
                                    <input type="checkbox"/>
                                </td>
                                <td>
                                    <a href="@Url.Content("~/News/Detail/" + item.Id)" target="_blank">@Html.Raw(Html.Truncate(Html.RemoveHtmlTag(item.Title), 100))</a>
                                </td>
                                <td>
                                    @item.ReadTimes
                                </td>
                                <td class="center">
                                    @item.CreatedTime
                                </td>
                                <td class="center">
                                    <ul class="hor-list piped">
                                        <li>@Html.ActionLink("详细", "Detail", "News",new { id = item.Id }, new { target = "_blank" })</li>
                                        <li>@Html.ActionLink("修改", "Edit", "NewsAdmin", new { id = item.Id }, new { target = "_self" })</li>
                                        <li>@Html.ActionLink("删除", "Delete", "NewsAdmin", new { id = item.Id }, new { target = "_self",data="delete" })</li></ul>
                                    
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
                @Html.Partial("_AdminPager", Model.Item)
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".dataTable ul li a[data='delete']").click(function () {
                return confirm("确定真的要删除改记录吗？");

            })
            //            //Datatable
            //            $('.dataTable').dataTable({
            //                "oLanguage": {
            //                    "sUrl": '@Url.Content("~/Scripts/Admin/jquery.dataTable.cn.txt")'
            //                },
            //                "bProcessing": true,  
            //                "sPaginationType": "full_numbers",
            //                "bJQueryUI": true,
            //                "bServerSide" : true,
            //                "sAjaxSource" : "@Url.Content("~/NewsAdmin/GetNews/")"
            //            });

            //            //Selectmenu
            //            $('.forcewidth').selectmenu({ width: 120 });
            //            $('select').selectmenu();
        })
    
    </script>
